<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

</head>


<body>
<div id="box" style="width:110px;height:110px;background-color:red"></div>

<script>
    document.addEventListener('click',(e)=>{
        // alert('zhixing')
        var  box = document.getElementById('box');
        if(box.contains(e.target)){
            alert('在内');
        }else{
            alert('在外');
        }
    })

</script>



</body>
</html>






